package dragon.tagext.util;

import java.io.IOException;

import javax.servlet.jsp.JspContext;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;

import dragon.core.util.StringUtils;

public class Parameter extends SimpleTagSupport {

	private String param;

	@Override
	public void doTag() throws JspException, IOException {

		if (StringUtils.isEmpty(param)) {
			return;
		} else {
			param = param.trim();
		}

		JspContext jspContext = getJspContext();
		JspWriter out = jspContext.getOut();
		out.print(((PageContext) jspContext).getRequest().getParameter(param));
	}

	/**
	 * @param param
	 *            参数名
	 */
	public void setParam(String param) {
		this.param = param;
	}

}
